home *** CD-ROM | disk | FTP | other *** search
/ Internet.Works 39 / Issue 39.iso / pc / PCSoftware / AceHTML 4.0 / AceHTML4Pro.exe / %MAINDIR% / ScriptDef / Context menu.sd < prev    next >
Encoding:
INI File  |  2000-08-31  |  3.6 KB  |  154 lines

  1. [SUBJECT]
  2. Description=Context menu Script
  3. ImageIndex=1
  4. Folder=DHTML Menu
  5.  
  6.  
  7. [HEAD_TEXT]
  8. ;<!--
  9. ;
  10. ;Developer's notes: This script employs two IE 5 techniques to create the context menu.
  11. ;First, we used the new conditional HTML comment of IE 5 to make the menu degrade perfectly
  12. ;with all browsers. Noticed the "strange" comment tag around the <div>- that's conditional
  13. ;comment that makes the <div> appear only in IE 5! Secondly, we used
  14. ;the new document. oncontextmenu event handler of IE 5 to detect and overide the default
  15. ;window's context menu when the surfer right clicks her mouse, and substitute it with our
  16. ;own instead. Everything else in the code is basic DHTML.
  17. ;
  18. ;-->
  19. ;<style>
  20. ;<!--
  21. ;/*
  22. ;Context menu Script-
  23. ;© Dynamic Drive (www.dynamicdrive.com)
  24. ;Last updated: 99/09/16th
  25. ;For full source code, 100's more DHTML scripts, and Terms Of Use,
  26. ;visit dynamicdrive.com
  27. ;*/
  28. ;
  29. ;#ie5menu{
  30. ;position:absolute;
  31. ;width:200px;
  32. ;border:2px solid black;
  33. ;background-color:menu;
  34. ;font-family:Verdana;
  35. ;line-height:20px;
  36. ;cursor:default;
  37. ;visibility:hidden;
  38. ;}
  39. ;
  40. ;.menuitems{
  41. ;padding-left:15px;
  42. ;padding-right:15px;
  43. ;}
  44. ;-->
  45. ;</style>
  46. ;
  47. ;<script language="JavaScript1.2">
  48. ;//set this variable to 1 if you wish the URLs of the highlighted menu to be displayed in the status bar
  49. ;var display_url=0
  50. ;
  51. ;
  52. ;function showmenuie5(){
  53. ;//Find out how close the mouse is to the corner of the window
  54. ;var rightedge=document.body.clientWidth-event.clientX
  55. ;var bottomedge=document.body.clientHeight-event.clientY
  56. ;
  57. ;//if the horizontal distance isn't enough to accomodate the width of the context menu
  58. ;if (rightedge<ie5menu.offsetWidth)
  59. ;//move the horizontal position of the menu to the left by it's width
  60. ;ie5menu.style.left=document.body.scrollLeft+event.clientX-ie5menu.offsetWidth
  61. ;else
  62. ;//position the horizontal position of the menu where the mouse was clicked
  63. ;ie5menu.style.left=document.body.scrollLeft+event.clientX
  64. ;
  65. ;//same concept with the vertical position
  66. ;if (bottomedge<ie5menu.offsetHeight)
  67. ;ie5menu.style.top=document.body.scrollTop+event.clientY-ie5menu.offsetHeight
  68. ;else
  69. ;ie5menu.style.top=document.body.scrollTop+event.clientY
  70. ;
  71. ;ie5menu.style.visibility="visible"
  72. ;return false
  73. ;}
  74. ;
  75. ;function hidemenuie5(){
  76. ;ie5menu.style.visibility="hidden"
  77. ;}
  78. ;
  79. ;function highlightie5(){
  80. ;if (event.srcElement.className=="menuitems"){
  81. ;event.srcElement.style.backgroundColor="highlight"
  82. ;event.srcElement.style.color="white"
  83. ;if (display_url==1)
  84. ;window.status=event.srcElement.url
  85. ;}
  86. ;}
  87. ;
  88. ;function lowlightie5(){
  89. ;if (event.srcElement.className=="menuitems"){
  90. ;event.srcElement.style.backgroundColor=""
  91. ;event.srcElement.style.color="black"
  92. ;window.status=''
  93. ;}
  94. ;}
  95. ;
  96. ;function jumptoie5(){
  97. ;if (event.srcElement.className=="menuitems")
  98. ;window.location=event.srcElement.url
  99. ;}
  100. ;</script>
  101. ;</head>
  102. ;
  103.  
  104.  
  105.  
  106. [BODY_TEXT]
  107. ;<!--[if IE]>
  108. ;<div id="ie5menu" onMouseover="highlightie5()" onMouseout="lowlightie5()" onClick="jumptoie5()">
  109. ;<div class="menuitems" url="`link0`">`caption0`</div>
  110. ;
  111. #insert point for macro text
  112. ;<hr>
  113. ;<div class="menuitems" url="mailto:dynamicdrive@yahoo.com">Email Us</div>
  114. ;</div>
  115. ;<![endif]-->
  116. ;<script language="JavaScript1.2">
  117. ;document.oncontextmenu=showmenuie5
  118. ;if (document.all&&window.print)
  119. ;document.body.onclick=hidemenuie5
  120. ;</script>
  121.  
  122.  
  123. [MACRO_ITEM]
  124. ;<div class="menuitems" url="`link`">`caption`</div>
  125. ;
  126.  
  127.  
  128. [`caption`]
  129. Kind=S
  130. Value=Caption
  131.  
  132.  
  133.  
  134. [`caption0`]
  135. Kind=S
  136. Value=Dynamicdrive.com
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143. [`link`]
  144. Kind=U
  145. Value=URL
  146.  
  147. [`link0`]
  148. Kind=U
  149. Value=http://dynamicdrive.com
  150.  
  151.  
  152.  
  153.  
  154.